package com.prp.gwt.client.user;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
import com.prp.gwt.client.user.profile.ProfileListener;
import com.prp.gwt.client.widgets.TopPanel;
import com.prp.gwt.client.widgets.UserBarPanel;

public class UserEntryPoint implements EntryPoint {

	private static HTML loading = new HTML("正在载入...");

	public void onModuleLoad() {
		UserBaseListener.getInstance().verify();
		RootPanel.get().add(loading);
	}

	public static void init() {
		RootPanel.get().remove(loading);
		RootPanel.get("header").add(TopPanel.getInstance());
		//RootPanel.get("tab").add(SearchPanel.getInstance());
		RootPanel.get("tab").add(UserBarPanel.getInstance());
		System.out.println(UserBarPanel.getInstance().getStyleName());
		TopPanel.getInstance().setListener(UserBaseListener.getInstance());
		ProfileListener.getInstance().getUser(-1);
		History.fireCurrentHistoryState();
	}
}
